home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 16
/
AMIGAplus Sonderheft 16 (1998)(ICP)(DE)[!].iso
/
pd
/
anwendungen
/
xpk_source
/
xpkmaster
/
fib.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-27
|
2KB
|
67 lines
#ifndef XPKMASTER_FIB_C
#define XPKMASTER_FIB_C
/* Routinesheader
Name: fib.c
Main: xpkmaster
Versionstring: $VER: fib.c 1.2 (09.01.1998)
Author: SDI
Distribution: Freeware
Description: FIB related routines
1.0 05.10.96 : first real version
1.1 20.12.97 : code cleanup
1.2 09.01.98 : added XPK_ALLINONE
*/
#include <proto/exec.h>
#include <proto/dos.h>
#include <exec/types.h>
#include "xpkmaster.h"
XPK_ALLINONE void updatefib(struct XpkBuffer *xbuf)
{
struct XpkStreamHeader *globhdr = &xbuf->xb_Headers.h_Glob;
XpkChunkHeader *lochdr = &xbuf->xb_Headers.h_Loc;
struct XpkFib *fib = &xbuf->xb_Fib;
LONG ulen, clen;
if(xbuf->xb_Headers.h_Glob.xsh_Flags & XPKSTREAMF_LONGHEADERS)
{
ulen = lochdr->xch_Long.xchl_ULen;
clen = lochdr->xch_Long.xchl_CLen;
}
else
{
ulen = lochdr->xch_Word.xchw_ULen;
clen = lochdr->xch_Word.xchw_CLen;
}
fib->xf_Type = XPKTYPE_PACKED;
fib->xf_CLen = globhdr->xsh_CLen + 8;
fib->xf_ULen = globhdr->xsh_ULen;
fib->xf_NLen = ulen + XPK_MARGIN;
fib->xf_CCur += ROUNDLONG (clen) + xbuf->xb_Headers.h_LocSize;
fib->xf_UCur += ulen;
fib->xf_ID = globhdr->xsh_Type;
fib->xf_SubVersion = globhdr->xsh_SubVrs;
fib->xf_MasVersion = globhdr->xsh_MasVrs;
CopyMem(globhdr->xsh_Initial, fib->xf_Head, 16);
percentages(fib);
}
XPK_ALLINONE void percentages (struct XpkFib *fib)
{
fib->xf_Ratio = 0;
if(fib->xf_ULen)
fib->xf_Ratio = 100 - 100 * fib->xf_CLen / fib->xf_ULen;
if(fib->xf_Ratio < 0)
fib->xf_Ratio = 0;
*(LONG *) fib->xf_Packer = fib->xf_ID;
fib->xf_Packer[4] = 0;
}
#endif /* XPKMASTER_FIB_C */